﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LPV_POS.mh_pos;
using System.Windows.Forms;

namespace LPV_POS.Module
{
    public enum loaithongbao
    {
        baoloi = 1,
        canhbao = 2,
        yesno = 3,
        thongtin = 4
    }
    public class Mod_messagebox
    {

        public void messagebox_pos(string caption, string content, int _loaithongbao)
        {
            //_loaithongbao = new loaithongbao();
            mh_thongbao frm_thongbao = new mh_thongbao(content, _loaithongbao);
            frm_thongbao.Text = caption;

            frm_thongbao.ShowDialog();
        }
    }
    public class MessageBox_LPV
    {
        public static DialogResult Show(string content)
        {
            int _loaithongbao = 2;            
            mh_thongbao frm_thongbao = new mh_thongbao(content, _loaithongbao);
            //
            int ipos = 0;
            if (content.Trim().IndexOf("\n") > 0)
            {
                content = content.Trim();
                for (int i = 0; i < content.Length - 1; i++)
                {
                    string s1 = content.ToCharArray()[i] + "";
                    string s2 = content.ToCharArray()[i + 1] + "";
                    if (s1 + s2 == "\n" || s2 == "\n")
                    {
                        ipos++;
                    }
                }
            }
            frm_thongbao.Size = new System.Drawing.Size(frm_thongbao.Size.Width, frm_thongbao.Size.Height + 20 * ipos);

            frm_thongbao.Text = "";
            DialogResult dlg = frm_thongbao.ShowForm();
            return dlg;
        }

        public static DialogResult Show(string content, string caption, MessageBoxButtons _MessageBoxButtons, MessageBoxIcon _MessageBoxIcon)
        {
            int _loaithongbao = 2;
            if (_MessageBoxButtons == MessageBoxButtons.YesNo)
                _loaithongbao = 3;

            mh_thongbao frm_thongbao = new mh_thongbao(content, _loaithongbao);
            frm_thongbao.Text = caption;
            DialogResult dlg = frm_thongbao.ShowForm();
            return dlg;
        }


        public static DialogResult Show(string content, string caption, MessageBoxIcon _MessageBoxIcon, string strText_btnCo, string strText_btnKhong)
        {
            int _loaithongbao = 3;//MessageBoxButtons.YesNo

            mh_thongbao frm_thongbao = new mh_thongbao(content, _loaithongbao,strText_btnCo, strText_btnKhong);
            frm_thongbao.Text = caption;
            DialogResult dlg = frm_thongbao.ShowForm();
            return dlg;
        }

        public enum chon
        { 
            Infomation,
            OkCancel
        }

        public static DialogResult Show(string content, chon _ochon)
        {
            int _loaithongbao = 2;
            if (_ochon == chon.Infomation)
                _loaithongbao = 4;
            else if (_ochon == chon.OkCancel)
                _loaithongbao = 3;

            mh_thongbao frm_thongbao = new mh_thongbao(content, _loaithongbao);
            //frm_thongbao.ShowDialog();
            frm_thongbao.Text = "";
            DialogResult dlg1 = frm_thongbao.DialogResult = DialogResult.None;
            DialogResult dlg = frm_thongbao.ShowForm();
            return dlg;
        }
    }
}
